{include file='yxworker/w_head'}
        <header class="order_header" style="font-size: 0.4rem;">
            <div class="go_back">
                <a style="color: #ffffff"  href="javascript:history.go(-1)">
                <img src="{$_G['URL']['WORKER_CSS']}images/order_03.png">
                返回</a>
            </div>
            定单信息修改
        </header>
        <style type="text/css">
            input{
                width: 96%;
                height: 0.55rem;
                font-size: 0.3rem;
                border: 1px solid #19b5ee;
                border-radius: 5px;
                margin-top: 0.05rem;
                padding: 0.05rem 0.1rem;
            }
            select{
                width: 100%;
                height: 0.68rem;
                font-size: 0.3rem;
                border: 1px solid #19b5ee;
                border-radius: 5px;
                margin-top: 0.05rem;
                padding: 0.05rem 0.1rem;
            }
        </style>


        <div class="s_items s_bg">
            <div class="s_title">
                <img src="{$_G['URL']['WORKER_CSS']}images/title_17.png">
                定单信息修改
            </div>
        </div>
        <form action='{php echo "/".createMobileUrl('w_orderedit',array("op"=>"save","themeid"=>$themeid,"uid"=>$record['uid'],"id"=>$id));}' method="post">  
            <div class="lmsz_cont">
                {if ($config['iseditorder']==1 || $myworker['level'] == '1')}
                <div class="form-group" id="username">
                    <p>{$config['nametext']}</p>
                        <input type="text" name="username" value="{$record['username']}" class="form-control">
                </div>
                <div class="form-group">
                    <p>{$config['mobiletext']}</p>
                        <input type="text" name="mobile" value="{$record['mobile']}" class="form-control">
                </div>

            {if $config['shopstype'] == 0 }
                {if !empty($config['shops'])}
            <div class="form-group">
                    <p>{$config['shops']}</label>
                <div class="col-sm-9 col-xs-12">
                    {if !empty($config['options'])}
                    <select id="shoptitle" name="shoptitle" > 
                    <option value="">请选择{$config['shops']}</option>
                    {loop $config['options'] $row}
                        <option value="{$row}" {if $row==$record['option']}selected="selected"{/if}>{$row}</option>
                    {/loop}
                    </select>
                    {/if}
                    </div>
            </div>
                {else}
                    <input  type="hidden" name="shoptitle" value="默认" id="shoptitle">
                {/if}
            {/if}



            <div {if empty($config['address'])}style="display: none;"{/if} class="form-group">
                <p>{$config['address']}</label>
                    <input class="form-control" placeholder="{$config['address']}必填" type="text" name="address_ordernew" value="{$record['address']}" id="address_ordernew">
            </div>

            {if $config['shopstype'] > 0 }
                <div {if empty($config['shops'])}style="display: none;"{/if} class="form-group">
                    <p>{$config['shops']}</p>
                        <input class="form-control" placeholder="{$config['shops']}必填" type="{php echo $config['shopstype']==2?'tel':'text';}" name="shoptitle" value="{$record['option']}" id="shoptitle">
                </div>
            {/if}
            {if $config['datetimetype'] > 0 }
                <div {if empty($config['datetime'])}style="display: none;"{/if} class="form-group">
                    <p>{$config['datetime']}</p>
                        <input class="form-control" placeholder="{$config['datetime']}必填" type="{php echo $config['datetimetype']==2?'tel':'text';}" name="date_ordernew" value="{$record['datetime']}" id="date_ordernew">
                </div>
            {else}
                <div {if empty($config['datetime'])}style="display: none;"{/if} class="form-group">
                    <p >{$config['datetime']}</p>
                                        <input class="form-control" placeholder="{$config['datetime']}" type="text" onfocus="(this.type='date')" value="{$record['datetime']}" name="date_ordernew" id="date_ordernew"/>
                </div>
            {/if}
            {/if}
            {if $myworker['level'] == '1'}
            <div class="form-group">
                    <label class="col-xs-12 col-sm-3 col-md-2 control-label">所属员工</label>
                <div class="col-sm-9 col-xs-12">
                    <select id="workerid" name="workerid" > 
                    <option value="0">请选择所属员工</option>
                    {loop $wlist $row}
                        <option value="{$row['uid']}" {if $record['workerid'] == $row['uid'] }selected="selected"{/if}>{if $system['ruanjian']==3}{$row['companyname']}-{/if}{$row['teamname']}-{$row['username']}</option>
                    {/loop}
                    </select>
                    <span class="help-block"></span>
                </div>
            </div>
            {/if}
            {if $config['maxcountall']>1 && ($config['iseditorder']==1 || $myworker['level'] == '1')}
            <div class="form-group">
                    <label class="col-xs-12 col-sm-3 col-md-2 control-label">所属团【身份:{if $record['type']==0}
                    {$tuanzhang}
                    {elseif $record['type']==1}
                        团员
                    {elseif $record['type']==9}
                        {$danmai}
                    {/if}】</label>
                <div class="col-sm-9 col-xs-12" style="position:relative">
                    <select id="tuanid" name="tuanid" > 
                    <option value="0">如需更改请在右侧修改团</option>
                    {loop $tuanlist $row}
                        <option value="{$row['id']}" {if $row['id']==$record['pid']}selected="selected"{/if}>{$row['username']}【{$row['mobile']}】已有{$row['renshu']}人</option>
                    {/loop}
                    </select>
                    <span onclick="searchForm()" style="position:absolute; right:0.2rem;top:0.13rem;width:1.5rem;height: 0.5rem; background: #47b9f0; font-size: 0.3rem;color: #ffffff; text-align: center;border-radius:0.5rem;"> 修改团 </span>
                </div>
            </div>
            {/if}
            {if !empty($_P['uid']) }
                <div class="form-group">
                    <p>会员卡余额</p>
                        <input type="text" name="chongzhi" value="{$fansinfo['chongzhi']}" class="form-control">
                </div>
                <div class="form-group">
                    <p>备注</p>
                        <textarea class="form-control" name="beizhu" rows="10" style="    width: 96%;
    height: 2.55rem;
    font-size: 0.3rem;
    border: 1px solid #19b5ee;
    border-radius: 5px;
    margin-top: 0.05rem;
    padding: 0.05rem 0.1rem;">{$fansinfo['beizhu']}</textarea>
                </div>
            {/if}
                <div style="text-align: center;">
                    <button class="l_btn" type="submit" >提交</button>
                </div>

            </div>
        </form>
        <style type="text/css">
            .btnnew{width: 1.25rem;    height: 0.35rem;    background: #71b643;    font-size: 0.3rem;    color: #ffffff;    padding: 10px;}
        </style>
        <div class="item" style="padding: 0.5rem; line-height: 0.4rem;height: auto;text-align: center;">
            {if $record['type']==9}
            <a href="/{php echo $this->createappurl('w_orderedit', array('op' => 'uptuanzhang','themeid'=>$themeid, 'id' => $record['id'], 'mobile' => $record['mobile']));}" onclick="if(!confirm('单买改为拼团,改为后为新团长，确定吗')) return false;" class="btnnew"> 单买升级为拼团 </a>
            {else}
            <a href="/{php echo $this->createappurl('w_orderedit', array('op' => 'newtuan','themeid'=>$themeid, 'id' => $record['id']));}" onclick="if(!confirm('原定单保留,开一个新团此客户为团长，确定吗')) return false;" class="btnnew"> 开新团 </a>
            {/if} 

            {if ($record['status']>0 || $record['status']==-2) && $record['isfinish']==1}
            {elseif ($record['status']>0 || $record['status']==-2)  && $record['xunifinish']==0}
                <a href="/{php echo $this->createappurl('w_orderedit', array('op' => 'xunifinish','themeid'=>$themeid, 'id' => $record['id'], 'mobile' => $record['mobile']));}" onclick="if(!confirm('虚拟组团,确定后客户无法再拉人进团,确定虚拟成团吗')) return false;" class="btnnew" style="background: #fec52d;color: #434342;"> 虚拟成团 </a>
            {elseif ($record['status']>0 || $record['status']==-2) && $record['xunifinish']==1}
                <a href="/{php echo $this->createappurl('w_orderedit', array('op' => 'unxunifinish','themeid'=>$themeid, 'id' => $record['id'], 'mobile' => $record['mobile']));}" onclick="if(!confirm('取消虚拟成团,确定后客户可再拉人进团,确定取消虚拟成团吗')) return false;" class="btnnew" style="background: #fec52d;color: #434342;"> 取消虚拟成团 </a>
            {/if}
            {if $myworker['level'] == '1'}
                <a href="/{php echo $this->createappurl('w_orderedit', array('op' => 'refund','themeid'=>$themeid, 'id' => $record['id'], 'mobile' => $record['mobile']));}" onclick="if(!confirm('当客户拍错或退单时可以直接退回原帐户，确定退款吗')) return false;" class="btnnew" style="background: #db4a53;"> 人工退款 </a>
            {/if}
        </div>
        <div class="item" style="padding: 0.5rem; line-height: 0.4rem;height: auto;">
            <p>在此可以修改客户填写的信息</p>
            <p>会员卡余额：客户在店内有充值的，可以在此进行备注，方便员工进行追踪和推销</p>
            <p></p> 
            <p>若团长更改至其它团则成为新团的团员，原来的团将由第二个付款的担任团长</p>            
            <p></p> 
        </div>
        <div class="item" style="line-height: 0.4rem;height: auto;">
            {$record['beizhu']}
        </div>
<script>
    function searchForm(){
        var txt = prompt("请输入团长名或手机号","");
        if (!txt) {
            alert("请输入团长的姓名或手机号");
        }else{ 
            $.ajax({
                type: 'POST',
                dataType : "json",
                url:'{php echo "/".createMobileUrl('w_orderedit',array("op"=>"searchtuan","themeid"=>$themeid,"uid"=>$record['uid'],"id"=>$id));}',
                data: {txt:txt},
                success: function(data) {
                data = data.message;
                 if(data.errcode == 0){
                    alert(data.msg);
                 }else if(data.errcode == 2 || data.errcode == 1){
                    var select = document.getElementById("tuanid");
                    select.options.length = 0;
                    $.each(data.tuanlist, function (n, value) {
                        $optiontxt = value.username +'【'+ value.mobile+'】已有'+value.renshu+'人';
                        select.options[select.options.length] = new Option($optiontxt,value.id);
                    });
                    if (data.errcode == 2){
                        alert('检索到多条记录，请选择正确的团长');
                    }
                 }
                },
                error: function() {
                }
            });

        }
    }

</script>

{include file='yxworker/w_foot'}
